﻿using CWY.Portal.Library;
using CWY.Portal.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace CWY.Portal.Controllers
{
    public class ChatController : Controller
    {        
        private ChatMessageViewModel _ViewModel { get; set; }
        public ChatController()
        {            
            _ViewModel = new ChatMessageViewModel();
        }
        

        public ActionResult Index()
        {
            return View(_ViewModel);
        }

        [HttpPost]
        public ActionResult Index(FormCollection form, ChatMessageViewModel _ViewModel)
        {
            MvcApplication._chat_box.Send(_ViewModel._ChatMessage.DisplayName, _ViewModel._ChatMessage.Message);
            return View(_ViewModel);
        }

    }
}
